import React, { Component } from 'react';
import styled from 'styled-components'
var moment = require('moment');

class Times extends Component {

	state = {
		time :''
	}
	render() {
		return (
				<Main>
				<p>{this.state.time}</p>
				</Main>
		);
	}
	
	componentDidMount() {
		this.getTime()
	}

	getTime = () => {
		setInterval(() => {
			this.setState(() => {
				return {time:moment().format("h:mm:ss")}
			})	
		},1000)
		return 
	}
}

const Main = styled.div`
	opacity: .9;
	position: relative;
	right: 70px;
	color: white;
	border-radius: 20px;
	text-align: center;
	color: black;
	font-size:20px;
`;

export default Times;